package com.hongyun.tms.common.dto.prodplan;

import com.alibaba.excel.annotation.ExcelIgnore;
import com.alibaba.excel.annotation.ExcelProperty;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.google.common.collect.Lists;
import com.hongyun.tms.common.annotation.Dict;
import com.hongyun.tms.common.annotation.Translate;
import com.hongyun.tms.common.annotation.excel.ExcelInfo;
import com.hongyun.tms.common.constants.TranslateAnnotationConstant;
import com.hongyun.tms.common.dto.pordwork.PordWorkExportDto;
import com.hongyun.tms.infra.excel.converter.LocalDateTimeOrDateConverter;
import com.hongyun.tms.infra.excel.converter.dict.DictConverter;
import com.hongyun.tms.infra.excel.converter.enums.ProdPlanEnumConverter;
import com.hongyun.tms.infra.excel.converter.enums.RateTradeTypeEnumConverter;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;

import java.io.Serializable;
import java.math.BigDecimal;
import java.time.LocalDate;
import java.util.List;

/**
 * 生产计划 导出
 *
 * @author liPeng
 * @date 2024-05-31
 **/
@Data
@ExcelInfo(fileName = "作业计划导出")
public class ProPlanExportDto implements Serializable {
    @ApiModelProperty(value = "计划作业时间")
    @DateTimeFormat(pattern = "yyyy-MM-dd")
    @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
    @ExcelProperty(value = "计划作业时间", converter = LocalDateTimeOrDateConverter.class, index = 0)
    private LocalDate planTime;

    @ApiModelProperty(value = "计划编码")
    @ExcelProperty(value = "计划编号", index = 1)
    private String planCode;

    @ApiModelProperty(value = "船名")
    @ExcelIgnore
    private String shipName;

    @ApiModelProperty(value = "航次")
    @ExcelIgnore
    private String voyage;


    @ApiModelProperty(value = "船名-航次")
    @ExcelProperty(value = "船名-航次", index = 2)
    private String shipNameVoyage;

    @ApiModelProperty(value = "总费用")
//    @ExcelProperty(value = "总费用", index = 3) 拖轮计费用
    private BigDecimal fee;

    @ApiModelProperty(value = "费用备注")
//    @ExcelProperty(value = "费用备注", index = 2) 拖轮计费用
    private String calculateRemark;

    @ApiModelProperty(value = "泊位")
    @ExcelProperty(value = "泊位", index = 3)
    private String berthNo;

    @ApiModelProperty(value = "贸别：内贸，外贸")
    @ExcelProperty(value = "贸别", converter = RateTradeTypeEnumConverter.class, index = 4)
    private String tradeType;

    @ApiModelProperty(value = "进出，进，出")
    @ExcelProperty(value = "进出", converter = ProdPlanEnumConverter.class, index = 5)
    private String inOut;

    @ApiModelProperty(value = "装卸：装，卸")
    @ExcelProperty(value = "装卸", converter = ProdPlanEnumConverter.class, index = 6)
    private String loadUnload;

    @ApiModelProperty(value = "客户名称")
    @ExcelProperty(value = "客户名称", index = 7)
    private String customerName;

    @ApiModelProperty(value = "货名")
    @ExcelProperty(value = "货名", index = 8)
    private String cargoName;

    @ApiModelProperty(value = "货重(吨)")
    @ExcelProperty(value = "货重(吨)", index = 9)
    private BigDecimal ton;

    @ApiModelProperty(value = "作业港区,字典")
    @Dict(code = "PORT_AREA", fieldName = "portAreaName")
    @ExcelProperty(value = "作业港区", converter = DictConverter.class, index = 10)
    private String portAreaCode;

    @ApiModelProperty(value = "码头ID")
    @Translate(fieldName = "dockName", tableName = TranslateAnnotationConstant.TABLE_TMS_DOCK)
    @ExcelProperty(value = "作业码头", index = 11)
    private Long dockId;

    @ApiModelProperty(value = "前吃水")
    @ExcelProperty(value = "前吃水", index = 12)
    private BigDecimal frontDraft;

    @ApiModelProperty(value = "后吃水")
    @ExcelProperty(value = "后吃水", index = 13)
    private BigDecimal rearDraft;

    @ApiModelProperty(value = "备注")
    @ExcelProperty(value = "备注", index = 14)
    private String remark;

    @ApiModelProperty(value = "0待审1已审")
    @ExcelProperty(value = "状态", converter = ProdPlanEnumConverter.class, index = 15)
    private Integer status;

    @ExcelIgnore
    private List<PordWorkExportDto> children = Lists.newArrayList();
}

